package com.mydemo.temp;

public enum TradeTypeEnum {
    /**
     * 普通转账交易
     */
    INSTANT_TRASFER("01", "普通转账交易"),
    INSTANT_ACQUIRING("11", "即时到账收单交易"),
    ENSURE_ACQUIRING("12", "担保收单交易"),
    PREPAY_ACQUIRING("13", "下订收单交易"),
    REFUND_ACQUIRING("14", "收单退款交易"),
    MERGE("15", "合并支付"),
    MOBILE_RECHARGE("16", "话费充值"),
    TRUST_COLLECT("17", "银行卡代扣交易"),
    FUND_SHARE("18", "基金份额交易"),
    CARD_TO_CARD("19", "卡卡转账"),
    FOS("FOS", "出款"),
    DEPOSIT("DEPOSIT", "充值");

    private final String code;

    private final String message;

    TradeTypeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static TradeTypeEnum getByCode(String code) {
        for (TradeTypeEnum resultCode : TradeTypeEnum.values()) {
            if (resultCode.getCode().equals(code)) {
                return resultCode;
            }
        }
        return null;
    }

    public static String getMsgByCode(String code) {
        TradeTypeEnum em = getByCode(code);
        if (em != null) {
            return em.getMessage();
        }
        return code;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
